﻿using Hospital.IRepository;
using Hospital.Model.entity;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Hospital.Repository
{
    public class RegistrationRepository : BaseRepository<Registration>, IRegistrationRepository
    {
        public RegistrationRepository(ISqlSugarClient db) : base(db)
        {
        }

        public async override Task<List<Registration>> QueryAsync()
        {
            return await db.Queryable<Registration>()
               .Mapper(a => a.Patient, a => a.PatientId, b => b.Patient.Id)
               .Mapper(a => a.Department, a => a.DepartmentId, b => b.Department.Id)
               .ToListAsync();
        }
    }
}
